﻿using ETA.DtoMappings;
using ETA.IService;
using Ninject;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ETA.UnitTest
{
    public class AskForHelpTest
    {
        private static IAskForHelpService _IAskForHelpService { set; get; }

        [SetUp]
        public void Init()
        {
            DtoMapConfig.InitMap();
            IKernel kernel = new StandardKernel(new NinjectModuleBuild());
            _IAskForHelpService = kernel.Get<IAskForHelpService>();
        }

        [Test]
        public void TestAddAskForHelp()
        {
           var res =  _IAskForHelpService.CreateAskForHelp(
                new CreateAskForHelpRequest
                {
                    AskForHelp = new Entity.AskForHelp
                    {
                        AskForHelpContent = "请求援助正文测试",
                        UserId = "7542448a-fd1e-420a-a8f9-dab529bb6c9c",
                        AskForHelpId = Guid.NewGuid().ToString(),
                        AskForHelpKindEnum = DomainEnum.AskForHelpKindEnum.法律纠纷,
                        AskForHelpTypeEnum = DomainEnum.AskForHelpTypeEnum.建议,
                        CreateDate = DateTime.Now
                    }
                }
             );
           Assert.True(res.Result.IsSuccess);
        }

        [Test]
        public void TestQueryForHelp()
        {
            var count = 0;
            _IAskForHelpService.QueryAskForHelpList(
              new QueryAskForHelpRequest
              {
                  UserId = "7542448a-fd1e-420a-a8f9-dab529bb6c9c"
              }, out count
             );
            Assert.True(count > 0);
        }
    }
}
